package com.icss.id.pojo;


import com.fasterxml.jackson.annotation.JsonBackReference;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

@Entity
@Table(name = "t_illegal_item")
public class Item {
    @Id
    @Column(name = "itemId")
    private Integer itemId;
    //违法行为
    @Column(name = "delict", length = 60)
    private String delict;
    //罚款
    @Column(name = "fine")
    private Integer fine;
    //记分
    @Column(name = "r_score")
    private Integer r_score;
    //违法人数
    @Column(name = "violationNum")
    private Integer violationNum;

    @OneToMany(targetEntity = Record.class)
    @JoinColumn(name = "itemId", referencedColumnName = "itemId")

    private List<Record> recordList = new ArrayList<>();


    public Item() {
    }

    @Override
    public String toString() {
        return "Item{" +
                "itemId=" + itemId +
                ", delict='" + delict + '\'' +
                ", fine=" + fine +
                ", r_score=" + r_score +
                ", violationNum=" + violationNum +
                '}';
    }

    public Integer getItemId() {
        return itemId;
    }

    public void setItemId(Integer itemId) {
        this.itemId = itemId;
    }

    public List<Record> getRecordList() {
        return recordList;
    }

    @JsonBackReference
    public void setRecordList(List<Record> recordList) {
        this.recordList = recordList;
    }

    public String getDelict() {
        return delict;
    }

    public void setDelict(String delict) {
        this.delict = delict;
    }

    public Integer getFine() {
        return fine;
    }

    public void setFine(Integer fine) {
        this.fine = fine;
    }

    public Integer getR_score() {
        return r_score;
    }

    public void setR_score(Integer r_score) {
        this.r_score = r_score;
    }

    public Integer getViolationNum() {
        return violationNum;
    }

    public void setViolationNum(Integer violationNum) {
        this.violationNum = violationNum;
    }


}
